﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RockBus.DataContracts;
using RockBus.Logging.Trace;
using RockBus.ServiceBus;
using System.ServiceModel.Channels;
using System.Transactions;

namespace RockBus.NuGetPkgs.Tests
{
    public class MessageHandler : IMessageHandler
    {
        public string Id
        {
            get { throw new NotImplementedException(); }
        }

        public System.Threading.Tasks.Task ProcessMessageAsync(Message request, Transaction transaction)
        {
            throw new NotImplementedException();
        }

        public System.Threading.Tasks.Task<Message> ProcessRequestAsync(Message request, Transaction transaction)
        {
            throw new NotImplementedException();
        }
    }

    [TestClass]
    public class RockBusClientTests
    {
        //[TestMethod]
        public void TestSubscriber()
        {
            string action = "SomeAction";
            string subscriberId = "Subscriber1";
            bool persistent = false;

            var fi = new FilterInfo(action, FilterTypeEnum.Action, action);
            var ei = new EndpointInfo(action, action, EndpointNameEnum.BasicHttpEndpoint, ExchangeTypeEnum.OneWay);
            var si = new SubscriberInfo(subscriberId, false, null, new[] { fi }, new[] { ei });

            var sd = new SubscriptionDetail(subscriberId, action, action, action, persistent);
            si.AddSubscriptionInfo(sd, action);

            var sub = new SubscriberClient(new TraceLogger(), new MessageHandler(), si);
            sub.SubscribeAsync(false);
        }
    }
}
